const path = require("path");
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

module.exports = {
  publicPath: process.env.NODE_ENV === "production" ? "././" : "./",
  outputDir: "dist/chainshop/",
  assetsDir: "./static",
  productionSourceMap: false,
  parallel: false,
  lintOnSave: false,
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        // path.resolve(__dirname, "./src/assets/css/variable.less")
      ],
    },
  },
  devServer: {
    proxy: {
      "/api": {
        target: "http://192.168.30.188:8999/api",
        changeOrigin: true,
        ws: false,
        pathRewrite: {
          "^/api": "",
        },
      },
    },
    // https: true,
    overlay: {
      warnings: true,
      errors: true,
    },
  },
  configureWebpack: {
    plugins: [
      // new UglifyJsPlugin({
      //     uglifyOptions: {
      //         compress: {
      //             drop_console: true,
      //         },
      //     },
      // }),
    ],
    externals: {
      AWSC: 'AWSC',
    },
  },

  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          require('postcss-pxtorem')({
            rootValue: 192,
            selectorBlackList: ['weui', 'mu'],
            propList: ['*']
          })
        ]
      }
    },
  },
  runtimeCompiler: true,
};
